-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added FocusedWindow event and raw winit WindowEvents #956
Conversation
crates/bevy_window/src/event.rs
Outdated
|
||
/// An event that indicates a window has received or lost focus. | ||
#[derive(Debug, Clone)] | ||
pub struct FocusedWindow { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it can be focused or unfocused, maybe a different name may be valuable. Something like WindowFocus
or FocusChanged
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally like WindowFocus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm starting to think that we shouldn't expose winit events directly. The whole point of bevy_window / bevy_input is to make user-facing code backend-agnostic. If we add console support in the future, it likely won't go through winit, which means user-facing code directly referencing winit events will break. Or in the future if we decide to replace winit with something else, that would be a breaking change.
Edit: the rationale for exposing winit events was that it "filled in the gaps" while bevy_window is fleshed out. But if we use winit events to fill in the gaps, that allows people to do what they want "the hackey way" and reduces the desire/need to expose things "the right way".
crates/bevy_window/src/event.rs
Outdated
|
||
/// An event that indicates a window has received or lost focus. | ||
#[derive(Debug, Clone)] | ||
pub struct FocusedWindow { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally like WindowFocus
I removed the winit events, renamed to |
Also adds a new example demonstrating how to use both.